#use for loggin
#userinfo:(format:username:passwd)
userinfo = {'王德耀':'123','李洁':'456','张三丰':'789'}

loggin_count = 0
while True:
    if loggin_count < 3:
        username = input("pls enter username:")
        userpasswd = input("pls enter userpasswd:")
        if username not in userinfo.keys():
            print("username error! try again") # 这里的报错，一般都是报账号或密码错误
            loggin_count += 1
        else:
            if userpasswd == userinfo[username]:
                print("loggin successfully!")
                break
            else:
                print("passwd error! try again")
            loggin_count += 1
    else:
        print("wrong username or passwd more than 3 times, pls login again")
        break
